package com.cly.controller;

import com.cly.result.JsonRequest;
import com.cly.service.IExamStatisticsService;
import com.cly.statistics.PieStatistics;
import com.cly.statistics.SumStatistics;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 考试统计控制类
 *
 * @author by 春风能解释
 * <p>
 * 2024/10/15
 */
@RestController
@RequestMapping("/examChats")
@RequiredArgsConstructor
@Tag(name = "考试统计控制类", description = "考试统计访问接口")
public class ExamStatisticsController {

    /**
     * 考试统计服务
     */
    private final IExamStatisticsService examStatisticsService;

    /**
     * 考试总数
     *
     * @return 考试总数
     */
    @GetMapping("/count")
    @Operation(summary = "考试总数")
    public JsonRequest<List<SumStatistics<Long>>> sumStatisticsExam() {
        return examStatisticsService.sumStatisticsExam();
    }

    /**
     * 试题类型统计
     *
     * @return 试题类型统计
     */
    @GetMapping("/typePie")
    @Operation(summary = "试题类型统计")
    public JsonRequest<List<PieStatistics<Long>>> sumStatisticsExamType() {
        return examStatisticsService.sumStatisticsExamType();
    }

}
